<!DOCTYPE html>
<html>
	<head>
		<meta charset="utf-8" />
		<meta name="viewport" content="width=device-width,height=device-width initial-scale=1.0, maximum-scale=1.0, user-scalable=no" />
		<title>登录</title>
		<link rel="stylesheet" href="../../page/shuguang/css/login.css" />
	</head>
	<body>
		<div class="wrap">
			<div class="wrapTop">
				<img src="../../page/shuguang/img/bj.png"/>
			</div>
			<div class="loginMain">
				<div class="content">
					<div><label><span><img src="../../page/shuguang/img/user-icon.png" height="24"/></span><input type="text" name="" id="pName" value="" autocomplete="off" placeholder="输入用户名"/></label></div>
					<div><label><span><img src="../../page/shuguang/img/password.png" height="24"/></span><input type="password" name="" id="password" value=""  autocomplete="off" placeholder="输入密码"/></label></div>
					<div class="login"><p>登录</p></div>
					<div class="login_register"><span>暂无账号，<a href="../shuguang/redirectToRegister.do">点击注册</a></span></div>
				</div>
			</div>
			<div class="wrapBottom">
				<img src="../../page/shuguang/img/round.png"/>
			</div>
			
		</div>

		
		<script src="../../page/shuguang/js/jquery.min.js"></script>
		<script src="../../page/shuguang/js/page.js"></script>
		<script>
			$(window).on("load",function(){
				$("#pName").val("");
				$("#password").val("");
				//登录
				function login() {
					var pName = $("#pName").val();
					var password = $("#password").val();
					$.ajax({
						type: "post",
						url: "../shuguang/login.do",
						data:{"pName":pName,"password":password},
						dataType: "json",
						success: function (data) {
							if (data.code == 200) {
								window.location.href = "../shuguang/redirectToIndex.do";
//http://localhost:8080/shuguang/redirectToIndex.do
							} else {
								alert("用户名或密码错误");
							}
						}
					});
				}
				//注册页面
				$(".login").on("click",function(){
					login();
				});
			});
		</script>
	</body>
</html>
